package com.blunka.framework.client.ui.server;

import java.awt.BorderLayout;

import javax.swing.JPanel;
import javax.swing.JScrollPane;

import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea;

/**
 *
 *
 * @平台：统一开发平台
 * @文件名称：ViewSqlPanel.java
 * @文件描述：视图sql编辑器
 * @author xuqiang
 * @日期：2018年5月29日上午10:50:11
 *
 */
public class ViewSqlPanelServer extends JPanel{

	public static ViewSqlPanelServer viewSqlPanel = new ViewSqlPanelServer();

	/**
	 * Sql编辑器
	 */
	private RSyntaxTextArea viewSqlTextArea;

	public static ViewSqlPanelServer newInstance(){
		return viewSqlPanel;
	}

	private ViewSqlPanelServer(){
		this.setLayout(new BorderLayout());
		viewSqlTextArea = new RSyntaxTextArea();
		viewSqlTextArea.setSyntaxEditingStyle(RSyntaxTextArea.SYNTAX_STYLE_SQL);
		JScrollPane areaScrollpanel = new JScrollPane(this.viewSqlTextArea);
		add(areaScrollpanel, BorderLayout.CENTER);

	}

	/**
	 * 设置视图sql语句
	 * @param sql
	 */
	public void setViewSql(String sql){
		viewSqlTextArea.setText(sql);
	}

	/**
	 * 获取视图sql语句
	 * @return
	 */
	public String getViewSql(){
		return viewSqlTextArea.getText();
	}
}
